{include file="public/header"}
<body>
<div id="app">
    <div class="ht-main">

        <div class="ht-main-body" style="padding-top: 10px">
            <el-table :data="tableData" border>
                <el-table-column
                        align="center"
                        prop="id"
                        label="ID">
                </el-table-column>

                <el-table-column
                        align="center"
                        prop="admin.user_name"
                        label="用户名">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="ip"
                        label="IP">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="create_time"
                        label="时间">
                </el-table-column>
            </el-table>
            <div class="ht-main-page">
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="page"
                        :page-sizes="[15, 200, 300, 400]"
                        :page-size="limit"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="total">
                </el-pagination>
            </div>
        </div>

    </div>
</div>


{include file="public/common"}
<script>
    new Vue({
        el: "#app",
        data: function () {
            return {
                activeTab: 'first',
                tableData: [],
                content: '编辑',
                total: 0,
                page: 1,
                limit: 15,
            }
        },
        created: function () {
            this.getData()
        },
        methods: {

            getData: function () {
                var that = this
                axios.post('{:url("Admin/adminLog")}', {
                    limit: that.limit,
                    page: that.page,
                }).then((res) => {
                    console.log(res.data)
                    that.tableData = res.data.data.data
                    that.total = res.data.data.total
                })
            },
            doAdd: function () {
                this.is_edit = true
                this.content = '添加'
                this.editData = this.editDataTemp
            },
            edit: function (data) {
                this.is_edit = true
                this.content = '编辑'
                this.editData = data
                console.log(data)
            },
            goBack: function () {
                this.is_edit = false
            },
            del: function (data) {
                var that = this
                that.$confirm('确定删除么?', '提示', {
                    type: 'warning',
                    lockScroll: false
                }).then(() => {
                    axios.post('{:url("Banner/BannerDel")}', {id: data.id}).then((res) => {
                        let result = res.data;
                        if (result.code === 1) {
                            that.showSuccessMsgCall(function () {
                                location.reload()
                            })
                        } else {
                            that.showErrorMsg(result.msg)
                        }
                    })
                })
            },
            handleSizeChange: function (e) {
                this.limit = e
            },
            handleCurrentChange: function (e) {
                this.page = e
            }
        },
        watch: {
            page(v) {
                this.getData()
            },
            limit() {
                this.getData()
            }
        }
    })
</script>
</body>
</html>
